from appium import webdriver
class Base():
    def __init__(self):
        cap={
            "platformName": "Android",
            "appium:deviceName": "emulator-5554",
            "appium:automationName": "uiautomator2",
            "appium:appPackage": "com.xiachufang",
            "appium:appActivity": ".activity.home.HomeActivity",
            "appium:noReset": True
        }
        self.driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub',cap)
        self.driver.implicitly_wait(20)
    def find_ele(self,loc):
        ele=self.driver.find_element(*loc)
        return ele
    def hua(self,a,s,d,f):
        self.driver.swipe(a,s,d,f,300)
    def dj(self,a,b):
        self.driver.tap(a,b,300)
    def jie(self,a):
        self.driver.save_screenshot(a)
    def tui(self):
        self.driver.quit()

    